Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][FIX] account_invoice_section_sale_order: FWD port and fix test-case #1871

Open
wants to merge 5 commits into
base: 17.0
Choose a base branch
from

Conversation

LucasTran380381
Copy link

@LucasTran380381 LucasTran380381 commented Dec 31, 2024

FWD ports

#1774
#1862
#1770

Fix test-case

test_create_invoice_with_currency change compare

self.assertEqual(invoices.amount_total, 80) => self.assertEqual(invoices.amount_untaxed, 80)

mmequignon and others added 5 commits December 31, 2024 16:46
the `sale.order._create_invoices() method does not only requires
`create` access to the `account.move` and `account.move.line` models.

Because we're actually sorting lines after the creating, it requires
`read` access to sort, and `write` access to modify their sequence.

This is problematic when interracting with other modules like
`invoice_mode_at_shipping` where stock users are the ones to create
invoices.

This commit adds a few `sudo()` in the code, in order to avoid granting
`read` and `write` access to users that shouldn't be allowed to read and write invoices.
@miguel-S73
Copy link
Contributor

@sergiocorato @simahawk Could any of you kindly review this PR? Thank you!

@pilarvargas-tecnativa
Copy link

@TDu Can you take a look at this fix please?

Copy link
Member

@StefanRijnhart StefanRijnhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the tests! I see they were caused by Odoo adding taxes to demo products in odoo/odoo@1443e5503c7396512a. Hope we can merge this one fast. Just a small question.

for move_line in self.env["account.move.line"].browse(move_line_ids):
if move_line.display_type == "line_section":
# add extra indent for existing SO Sections
move_line.name = f"- {move_line.name}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you removing this extra indent bit on purpose? I don't see it in the original fixes that you are porting here, but then again it was introduced in the migration of v15 (439ff49) and the fixes ported here are from 14.0.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It ported from commit https://github.com/OCA/account-invoicing/pull/1774

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where in #1774 the extra indent is removed. Again, that patch is on 14.0 whereas the extra indent was only introduced in 15 if I understand correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants